<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>上传项目资料</title>
		<link
			rel="stylesheet"
			href="{{ url_for('static', filename='css/style.css') }}"
		/>
	</head>
	<body>
		<div class="container">
			<!-- <div class="header-nav">
				<a
					href="#"
					class="btn btn-back"
					onclick="history.back();  return false;"
					>返回</a
				>
				<h1>上传项目资料</h1>
			</div> -->
			<div class="card">
				<a
					href="#"
					class="btn btn-back"
					onclick="history.back();  return false;"
					>返回</a
				>
				<h2>上传项目资料</h2>
				<form
					action="{{ url_for('upload_project_document', project_id=project_id) }}"
					method="post"
					enctype="multipart/form-data"
				>
					<!-- 添加隐藏字段确保兼容性 -->
					<input type="hidden" name="project_id" value="{{ project_id }}" />

					<!-- 原有表单元素保持不变 -->
					<div class="form-group">
						<label for="name">文件名称</label>
						<input
							type="text"
							id="name"
							name="name"
							required
							autocomplete="off"
						/>
					</div>
					<div class="form-group">
						<label for="document_type">文件类型</label>
						<input type="text" id="document_type" name="document_type" />
					</div>

					<!-- 新增文件上传字段 -->
					<div class="form-group">
						<label for="file">选择文件</label>
						<input
							type="file"
							id="file"
							name="file"
							required
							onchange="document.getElementById('name').value = this.files[0].name.split('.').slice(0, -1).join('.')"
						/>
					</div>

					<!-- 添加提交按钮 -->
					<div class="form-group">
						<button type="submit" class="btn" style="width: 100px">
							上传文件
						</button>
					</div>
				</form>
			</div>
		</div>
	</body>
</html>
